package pers.cnzdy.tutorial.Chapter5_UI.Section7_ListView;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import java.util.List;

import pers.cnzdy.tutorial.R;

public class KnowledgePointsActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_knowledge_points);

        KnowledgePoints knowledgePoints = new KnowledgePoints();
        List<KnowledgePoints.KnowledgePoint> knowledgePointList =
                knowledgePoints.getKnowledgePointList();

        RecyclerView recyclerView = findViewById(R.id.kps_recycler_view);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
//        layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);

        //GridLayoutManager layoutManager = new GridLayoutManager(this, 4);
        recyclerView.setLayoutManager(layoutManager);
        KnowledgePointsAdapter adapter =
                new KnowledgePointsAdapter(knowledgePointList);
        recyclerView.setAdapter(adapter);
    }
}
